b92b7a6e2d0a899fa7eb0badf3262905247f9e84,api/src/main/java/org/xnio/AbstractIoFuture.java,AbstractIoFuture,await,#,63
Before Change
* {@inheritDoc}
*/
public Status await() {
synchronized (lock) {
boolean intr = Thread.interrupted();
try {
if (status == Status.WAITING) {
Xnio.checkBlockingAllowed();
do {
try {
lock.wait();
} catch (InterruptedException e) {
intr = true;
}
} while (status == Status.WAITING);
}
} finally {
if (intr) {
Thread.currentThread().interrupt();
}
}
return status;
}
}
After Change
* {@inheritDoc}
*/
public Status await() {
final Thread thread = Thread.currentThread();
State<T> state;
for (;;) {
state = getState();
if (state.getStatus() != Status.WAITING) {
return state.getStatus();
}
Xnio.checkBlockingAllowed();
State<T> withWaiter = state.withWaiter(thread);
if (compareAndSetState(state, withWaiter)) {
boolean intr = Thread.interrupted();
try {
do {
LockSupport.park(this);
if (Thread.interrupted()) intr = true;
state = getState();
} while (state.getStatus() == Status.WAITING);
return state.getStatus();
} finally {
if (intr) thread.interrupt();
}